package structure.adapter;

import java.util.concurrent.Callable;

/**
 * @author lzp
 * @Date:2023/2/24
 * @description: 实现 Callable接口的任务
 */
public class Task implements Callable<Long> {
	private long num;

	public Task(Long num) {
		this.num = num;
	}

	/**
	 * 累加，从0+1+2.... num
	 */
	@Override
	public Long call() throws Exception {
		long r = 0;
		for (long i = 0; i < num; i++) {
			r += i;
		}
		return r;
	}
}
